package com.mandy.datamerge.mock.service;

import com.google.common.collect.Lists;
import com.mandy.datamerge.annotation.DataMergeMark;
import com.mandy.datamerge.mock.entity.User;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @className UserService
 * @description
 * @author jianyongjie@126.com
 * @date 2020/7/2 10:40 下午
 * @version 1.0.0
 **/
@Service
public class UserService {

    @DataMergeMark
    public User getUser() {
        User user = new User();
        user.setId(1L);
        user.setName("张三");
        user.setPositionId(1L);
        return user;
    }

    @DataMergeMark
    public List<User> getAll() {
        ArrayList<User> users = Lists.newArrayList();

        User user = new User();
        user.setId(1L);
        user.setName("张三");
        user.setPositionId(1L);
        users.add(user);

        User user2 = new User();
        user2.setId(2L);
        user2.setName("李四");
        users.add(user2);

        return users;
    }

    @DataMergeMark
    public List<User> getByPositionId(Long positionId) {
        ArrayList<User> users = Lists.newArrayList();

        User user = new User();
        user.setId(1L);
        user.setName("张三");
        user.setPositionId(1L);
        users.add(user);

        User user2 = new User();
        user2.setId(2L);
        user2.setName("李四");
        users.add(user2);

        return users;
    }
}
